<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:ace="http://www.icefaces.org/icefaces/components"
   xmlns:icecore="http://www.icefaces.org/icefaces/core">
   <h:body> 
      <ui:composition template="/WEB-INF/templates/simpleuser/template.xhtml">
         <ui:define name="content">
		<f:event type="preRenderView" listener="#{deviceInfoBean.forwardDevicesIfNotSelection}"/>
         
         <h:form id="form-devicedata">
            <icecore:singleSubmit />
            <ace:panel     closable  = "false"
	                       toggleable= "false"
	                       collapsed = "false" >
       		<h:panelGrid  columns="2"  style="margin-left:auto; margin-right:auto;">
	            <h:outputText   value="#{msgs['devicedata.name']}"/>
	            <h:outputText   value="#{deviceInfoBean.selectedDevice.name}" /> 
	            <h:outputText   value="#{msgs['devicedata.type']}"/>
	            <h:outputText   value="#{deviceInfoBean.selectedDevice.type}" /> 
	            <h:outputText   value="#{msgs['devicedata.description']}"/>
	            <h:outputText   value="#{deviceInfoBean.selectedDevice.description}" />
	            <h:outputText   value="#{msgs['devicedata.soundingtime']}"/>
	            <h:outputText   value="#{deviceInfoBean.selectedDevice.soundingtime}" />
	            <h:outputText   value="#{msgs['devicedata.actualizationtype']}"/>
	            <h:outputText   value="#{msgs[deviceInfoBean.selectedDevice.actualizationtype]}" />
	            <h:outputText   value="#{msgs['devicedata.connstate']}"/>
	            <h:outputText   value="#{msgs[deviceInfoBean.selectedDevice.state]}" />
	            <h:commandButton id="conn-btn-row" value="#{msgs[deviceInfoBean.selectedDevice.btnname]}" 
	                                        disabled="#{deviceInfoBean.selectedDevice.btndisabled}" 
	                                        actionListener="#{deviceInfoBean.selectedDevice.pushbutton}"/>
	        </h:panelGrid>
                </ace:panel>
	      
	                
	                <ace:panel id="field-list" header="#{msgs['devicedata.fieldlist']}"
                               toggleable="true" toggleSpeed="1000">
                       
		                    <ace:dataTable id="dev-field-list"
	                             value="#{deviceInfoBean.selectedDevice.fields}"
	                             var="field">
	                      		<ace:column id="field-list-name-col" headerText="#{msgs['devicedata.field.name']}">
	                          		<h:outputText id="field-list-name-row" value="#{field.name}"/>
	                      		</ace:column>  
		                      	<ace:column id="field-list-value-col" headerText="#{msgs['devicedata.field.value']}">
		                           	<h:outputText id="value-row" value="#{field.value}"/>
		                      	</ace:column>
		                      	<ace:column id="field-list-date-col" headerText="#{msgs['devicedata.field.lastdate']}">
		                           	<h:outputText id="field-list-vule-row" value="#{field.lastdate}"/>
		                      	</ace:column>  
	                  		</ace:dataTable>  
	                </ace:panel>
	                
	                <ace:panel id="command-list" header="#{msgs['devicedata.commandlist']}"
                               toggleable="true" toggleSpeed="1000">
	                     <ace:panel
	                	   		header    = "#{msgs['devicedata.commandlist.simlpe']}"
	                       		closable  = "false"
	                       		toggleable= "false"
	                       		collapsed = "false" >
		                    <ace:dataTable id="dev-simple-command-list"
	                             value="#{deviceInfoBean.selectedDevice.simplecmds}"
	                             var="cmd">
	                      		<ace:column id="simple-command-list-name-col" headerText="#{msgs['devicedata.command.name']}">
	                          		<h:outputText id="simple-command-list-name-row" value="#{cmd.name}"/>
	                      		</ace:column>  
		                      	<ace:column id="simple-command-list-cmd-col" headerText="#{msgs['devicedata.command.action']}">
		                           	<h:commandButton  id="onBttn" value="#{msgs['devicedata.command.onbutton']}" 
	                                                  actionListener="#{cmd.on}" disabled="#{cmd.disabledbtn}"/>
	                                <h:commandButton  id="offBttn" value="#{msgs['devicedata.command.offbutton']}" 
	                                                  actionListener="#{cmd.off}" disabled="#{cmd.disabledbtn}"/>
		                      	</ace:column>
		                      	<ace:column id="simple-command-list-state-col" headerText="#{msgs['devicedata.command.state']}">
		                           	<h:outputText id="simple-command-list-state-row" value="#{msgs[cmd.state]}"/>
		                      	</ace:column>  
	                  		</ace:dataTable>  
	                      </ace:panel>
	                      <ace:panel
	                	  	 	header    = "#{msgs['devicedata.commandlist.compund']}"
	                       		closable  = "false"
	                       		toggleable= "false"
	                       		collapsed = "false" >
		                    <ace:dataTable id="dev-compund-command-list"
	                             value="#{deviceInfoBean.selectedDevice.compundcmds}"
	                             var="cmd">
	                      		<ace:column id="compund-command-list-name-col" headerText="#{msgs['devicedata.command.name']}">
	                          		<h:outputText id="compund-command-list-name-row" value="#{cmd.name}"/>
	                      		</ace:column>  
		                      	<ace:column id="compund-command-list-cmd-col" headerText="#{msgs['devicedata.command.action']}">
		                           	<h:commandButton  id="compund-command-list-setBttn" value="#{msgs['devicedata.command.setbutton']}" 
	                                                  actionListener="#{cmd.set}" disabled="#{cmd.disabledbtn}"/>
	                                <h:inputText  id="compund-command-list-value-cmd" value="#{cmd.value}">
	                                    <f:validateLongRange minimum="0" maximum="65535" />
	                                </h:inputText>
	                                <h:messages for="compund-command-list-value-cmd" />
		                      	</ace:column>
		                      	<ace:column id="compund-command-list-state-col" headerText="#{msgs['devicedata.command.state']}">
		                           	<h:outputText id="compund-command-list-state-row" value="#{msgs[cmd.state]}"/>
		                      	</ace:column>  
	                  		</ace:dataTable>  
	                       </ace:panel>
	                </ace:panel>  
	                
	                <ace:panel id="alarm-list" header="#{msgs['devicedata.alarmlist']}"
                               toggleable="true" toggleSpeed="1000">  
	                   <ace:dataTable id="dev-alarm-list"
	                             value="#{deviceInfoBean.selectedDevice.alarms}"
	                             var="alarm">
	                      		<ace:column id="alarm-list-name-alrm" headerText="#{msgs['devicedata.alarm.name']}">
	                          		<h:outputText id="alarm-list-name-row" value="#{alarm.name}"/>
	                      		</ace:column>  
		                      	<ace:column id="alarm-list-field-col" headerText="#{msgs['devicedata.alarm.field']}">
		                           	<h:outputText id="alarm-list-value-row" value="#{alarm.field}"/>
		                      	</ace:column>
		                      	<ace:column id="alarm-list-value-col" headerText="#{msgs['devicedata.alarm.value']}">
		                           	<h:outputText id="alarm-list-vule-row" value="#{alarm.value}"/>
		                      	</ace:column>  
		                      	<ace:column id="alarm-list-criteria-col" headerText="#{msgs['devicedata.alarm.criteria']}">
		                           	<h:outputText id="alarm-list-criteria-row" value="#{alarm.criteria}" />
		                      	</ace:column>
		                      	<ace:column id="alarm-list-state-col" headerText="#{msgs['devicedata.alarm.state']}">
		                           	<h:outputText id="alarm-list-state-row" value="#{msgs[alarm.state]}" />
		                      	</ace:column>
	                  		</ace:dataTable>  
	                </ace:panel>
            </h:form> 
         </ui:define>					
      </ui:composition> 
   </h:body> 
</html>	